package com.jwm.power.repository;

import com.jwm.power.model.entity.InquiryT;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface InquiryRepository extends JpaRepository<InquiryT, Integer>, JpaSpecificationExecutor<InquiryT> {
    InquiryT findByid(@Param("id") Integer id);
    @Query(value = "SELECT country FROM inquirydata WHERE inquirydate = :inquirydate AND sales = :sales", nativeQuery = true)
    List<String> findCountryByInquirydateAndSales(@Param("inquirydate") Date inquirydate, @Param("sales")String sales);

    @Override
    List<InquiryT> findAll();
}
